// 安全监控系统  预览模式下 断电区域相关功能的组件开发
import component from "../Component.js"
import {LayerType} from "../../experience/db/SafeMonitorType.js"

export default class PoweredAreaPreview extends component {
    constructor() {
        super()
    }

    control() {
        this.PoweredAreaIsShow = true
        const AreaVisibleIcon = $('#poweredAreaVisible')
        AreaVisibleIcon.on('click',() => {
            this.PoweredAreaIsShow = !this.PoweredAreaIsShow
            console.log('this.PoweredAreaIsShow--',this.PoweredAreaIsShow)
            const eyeIcon = $('#paVisibleEye')
            if(this.PoweredAreaIsShow) {
                eyeIcon.removeClass('fa-eye-slash')
                eyeIcon.addClass('fa-eye')
                // 显示 断电区域
                // this.drawer.source(LayerType.SMPoweredArea).setVisible(true)
                this.drawer.drawer.SMPoweredArea.setVisible(true)
            }
            else {
                eyeIcon.removeClass('fa-eye')
                eyeIcon.addClass('fa-eye-slash')
                // 隐藏断电区域
                this.drawer.drawer.SMPoweredArea.setVisible(false)
            }
        })
    }

    template() {
        const PoweredAreaVisibleButton = `<div id="poweredAreaVisible"  class="GisUtilIcon" style="position: absolute;top: 150px;left: 25px;z-index: 999"><i id="paVisibleEye" class="fas fa-eye"></i></div>`
        this.$$("body").append(PoweredAreaVisibleButton);
    }
}



